function moveElement(elementId, x, y, time) {
    if (!document.getElementById) return false;
    if (!document.getElementById(elementId)) return false;
    var element = document.getElementById(elementId);
    var preTop = parseInt(element.style.top);
    var preLeft = parseInt(element.style.left);
    if (preTop === y && preLeft === x) return false;

    var targetTop = preTop;
    var targetLeft = preLeft;
    if (targetTop > y) {
        targetTop--;
    }
    if (targetTop < y) {
        targetTop++;
    }
    if (targetLeft > x) {
        targetLeft--;
    }
    if (targetLeft < x) {
        targetLeft++;
    }
    element.style.position = "absolute";
    element.style.top = targetTop + "px";
    element.style.left = targetLeft + "px";
    var repeat = "moveElement('"+elementId+"',"+x+","+y+","+time+")";
    setTimeout(repeat, time);
}